import request from '@/utils/request'

// 查询账号信息列表
export function listAccount(query) {
  return request({
    url: '/account/list',
    method: 'get',
    params: query
  })
}

// 查询账号信息列表
export function writeOffListAccount(query) {
  return request({
    url: '/account/writeOffAccountList',
    method: 'get',
    params: query
  })
}

// 查询账号信息详细
export function getAccount(accountId) {
  return request({
    url: '/account/' + accountId,
    method: 'get'
  })
}

// 新增账号信息
export function addAccount(data) {
  return request({
    url: '/account/addAccount',
    method: 'post',
    data: data
  })
}

// 获取二维码接口
export function getQrcodeByDID(data) {
  return request({
    url: '/account/getQrcodeByDID',
    method: 'post',
    data: data
  })
}

// 获取二维码接口
export function checkQrcode(data) {
  return request({
    url: '/account/checkQrcode',
    method: 'post',
    data: data
  })
}

// 修改账号信息
export function updateAccount(data) {
  return request({
    url: '/account',
    method: 'put',
    data: data
  })
}

// 批量修改
export function batchUpdateAccount(accountIds,data){
  return request({
    url: '/account/'+accountIds,
    method: 'put',
    data: data
  })
}
// 删除账号信息
export function delAccount(accountId) {
  return request({
    url: '/account/' + accountId,
    method: 'delete'
  })
}

// 账号状态修改
export function changeAccountStatus(accountId, status) {
  const data = {
    accountId,
    status
  }
  return request({
    url: '/account/changeStatus',
    method: 'put',
    data: data
  })
}

// 批量账号状态修改
export function batchChangeAccountStatus(accountIds, status) {
  return request({
    url: '/account/batchChangeStatus/'+status+'/'+accountIds,
    method: 'put',
  })
}

//检测账号
export function checkAccountOfGroup(groupId){
  return request({
    url: '/account/checkAccountOfGroup/'+groupId,
    method: 'post',
    timeout: 100000 * 1000,
  })
}

//区域选择
export function areaList(data){
  return request({
    url: '/proxy/areaList2?key='+data,
    method: 'get'
  })
}

//
export function jsDeviceInfo(data) {
  return request({
    url: '/account/jsDeviceInfo',
    method: 'post',
    data: data
  })
}

//
export function sendCode(data) {
  return request({
    url: '/account/sendCode507',
    method: 'post',
    data: data
  })
}

//
export function smsLogin(data) {
  return request({
    url: '/account/smsLogin507',
    method: 'post',
    data: data
  })
}

//手机号密码挂号
export function loginByPwd(data) {
  return request({
    url: '/account/addAccountByMobileAndPwd',
    method: 'post',
    data: data
  })
}

//
export function listForTest(data) {
  return request({
    url: '/account/listForTest',
    headers: {
      isToken: false
    },
    method: 'get',
    data: data
  })
}

//手动刷新
export function tongbu(data) {
  return request({
    url: '/account/tongbu',
    method: 'get',
    data: data
  })
}

//获取iid和did
export function getDIdAndIid() {
  return request({
    url: '/account/getDIdAndIid',
    method: 'get',
  })
}

//手动刷新
export function changeDIdAndIid(accountId) {
  return request({
    url: `/account/changeDIdAndIid/${accountId}`,
    method: 'get',
  })
}
